package com.example.kotlindemo.activity

import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.util.Log
import com.example.kotlindemo.R
import com.example.kotlindemo.base.BaseActivity
import kotlinx.android.synthetic.main.activity_second.*

class SecondActivity : BaseActivity() {
    var name: String? = ""
    var sex: String? = ""

    companion object {
        fun show(context: Context, names: String, sexs: String) {
            context.startActivity(Intent(context, SecondActivity::class.java).apply {
                putExtra("name", names)
                putExtra("sex", sexs)
            })
        }
        var show2name: String? = ""
        var show2sex: String? = ""
        fun show2(context: Context, names: String, sexs: String) {
            show2name = names
            show2sex = sexs
            context.startActivity(Intent(context, SecondActivity::class.java))
        }
    }


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_second)
        name = intent.getStringExtra("name")
        sex = intent.getStringExtra("sex")
        Log.d("taskId", "SecondActivity$taskId")

        Log.d("show2name", "SecondActivity$show2name$show2sex")

        tv_content.setText("$name$sex")

        tv_content.setOnClickListener {
            val intent = Intent(this, ThirdActivity::class.java)
//            intent.putExtra("result", "我是返回数据")
//            setResult(Activity.RESULT_OK, intent)
            startActivity(intent)
//            finish()
        }
        Log.d("SecondActivity", "onCreate")

    }



    override fun onStart() {
        super.onStart()
        Log.d("SecondActivity", "onStart")

    }

    override fun onResume() {
        super.onResume()
        Log.d("SecondActivity", "onResume")

    }

    override fun onPause() {
        super.onPause()
        Log.d("SecondActivity", "onPause")

    }

    override fun onStop() {
        super.onStop()
        Log.d("SecondActivity", "onStop")

    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d("SecondActivity", "onDestroy")

    }

    override fun onRestart() {
        super.onRestart()
        Log.d("SecondActivity", "onRestart")

    }


}
